Maximum Number Of Distinct Elements After Operations | Leetcode 3397 | Weekly Contest 429 | Java